namespace nDeveloper.VSS.DifferenceEngine
{
    using System;
    using System.IO;

    public class DiffList_BinaryFile : IDiffList
    {
        private byte[] _byteList;

        public DiffList_BinaryFile(string fileName)
        {
            FileStream input = null;
            BinaryReader reader = null;
            try
            {
                input = new FileStream(fileName, FileMode.Open, FileAccess.Read);
                int length = (int) input.Length;
                this._byteList = new BinaryReader(input).ReadBytes(length);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                if (input != null)
                {
                    input.Close();
                }
            }
        }

        public int Count()
        {
            return this._byteList.Length;
        }

        public IComparable GetByIndex(int index)
        {
            return this._byteList[index];
        }
    }
}

